package jupiter.channel;
import org.json.*;

import jupiter.filters.FilterException;
import jupiter.message.Message;
public interface ChannelInterface {
	public JSONObject sendMessage(Message m);
	public Address address();
	
	//call to have your channel listening on another
	public void addListener(ChannelInterface channel, boolean callback) throws FilterException ;
	//call to stop your channel from listening on another
	public void removeListener(ChannelInterface channel, boolean callback) throws FilterException ;
	/**
	 * Don't call these yourself
	 */
	public void addedAsListener(ChannelInterface channel) throws FilterException ;  //called when you are added to something
	public void removedAsListener(ChannelInterface destroyed) throws FilterException ; //called when you are removed from something
	public void destroy() throws FilterException ;
	public JSONObject map() throws JSONException;

	public boolean canSendMessagesTo(ChannelInterface channel);
	public void resume();
	public JSONObject publicInfo();
	public JSONObject toJSON(boolean secret);
	public JSONObject update(JSONObject data) throws FilterException ;
	public JSONObject updatePublicInfo(JSONObject inf) throws FilterException ;
	public JSONObject modify(JSONObject data) throws FilterException ;
	public JSONObject subscribeAndUpdate(Address m) throws FilterException;
	public JSONObject unsubscribeAndUpdate(Address m) throws FilterException;
}
